package org.jiuling.spring.oss.minio.config;

import org.jiuling.minio.config.MinioConfig;
import org.jiuling.minio.coupler.MinioCoupler;
import org.jiuling.minio.operation.MinioBucketOperation;
import org.jiuling.minio.operation.MinioObjectOperation;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * MinioBean配置
 * @author 紫灵
 * @date 2024年01月11日 11时10分42秒
 */
@Component
@Configuration
public class MinioOssBeanConfig {

    @Bean
    @ConfigurationProperties(prefix = "jiu-ling.oss.minio")
    public MinioConfig minioConfig(){
        return new MinioConfig();
    }

    @Bean
    public MinioCoupler minioCoupler(){
        return new MinioCoupler(minioConfig());
    }

    @Bean
    public MinioBucketOperation minioBucketOperation(){
        return new MinioBucketOperation(minioCoupler());
    }

    @Bean
    public MinioObjectOperation minioObjectOperation(){
        return new MinioObjectOperation(minioCoupler());
    }

}
